﻿using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection;
using RayD.App.Quartz;
using RayD.Core;
using System;

namespace RayD.App.Setup
{
    /// <summary>
    /// Quartz 启动服务
    /// 在 AutofacModuleRegister.cs 中实现IJob对象的服务
    /// </summary>
    public static class QuartzSetup
    {
        public static void AddQuartzSetup(this IServiceCollection services)
        {
            if (services == null) throw new ArgumentNullException(nameof(services));

            if (AppSettings.JobOption.Enabled)
            {
                //设置定时启动的任务
                services.AddHostedService<QuartzService>();
            }
        }
    }
}
 